﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Mani.Common;
using Ghasam.Business.Services;
using Ghasam.Business.Domain.Entity;

public partial class NewSalesPerson : BasePage
{

    public override string ActionName
    {
        get
        {
            return "vw_newsalesperson";
        }
    }

    #region"Private Property"
    private ISalesPersonService salesPersonService;
    #endregion
    #region"Public Method"
    public ISalesPersonService SalesPersonService
    {
        get { return salesPersonService; }
        set { salesPersonService = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            SalesPerson s = new SalesPerson();
            s.Title = txtTitle.Text;
            s.Phone = txtPhoneNumber.Text;
            s.Address = txtAddress.Text;
            s.Balance = 0;
            s.CreateDate = DateTime.Now;
            s.ModifyStamp = DateTime.Now;
            SalesPersonService.SaveOrUpadate(s);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        UIHelper.ClientAlert(this, "با موفقیت ثبت شد");
        UIHelper.ClientRedirect(this, "SalesPersons.aspx");
    }
    #endregion
}
